package spring.in.action.chapter_01.config;

import java.io.PrintStream;

import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.ComponentScan.Filter;

import spring.in.action.chapter_01.FullStackCoder;
import spring.in.action.chapter_01.JavaTask;
import spring.in.action.chapter_01.Interface.ICoder;
import spring.in.action.chapter_01.Interface.ITask;

@Configuration
@ComponentScan(basePackages = "spring.in.action.chapter_01", excludeFilters =
{ @Filter(Configuration.class) })
public class CoderConfig
{
    @Bean
    public ICoder coder()
    {
        return new FullStackCoder(task());
    }

    @Bean
    public ITask task()
    {
        return new JavaTask(System.out);
    }

    @Bean
    public PrintStream out()
    {
        return System.out;
    }
}